<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>使用路由</title>
</head>
<body>
    <div id="app">
        <router-link to="/login" replace>
            登录
        </router-link>
        <router-link to="/resign" replace>
            注册
        </router-link>
        <!-- 定义容器 -->
        <router-view></router-view>
    </div>
</body>
<script src='../js/vue.js '></script>
<script src="./js/vue-router.js"></script>
<script>
    let login = {
        template:'<h1>登录组件</h1>'
    }
    let resign = {
        template:'<h1>注册组件</h1>'
    }
    let routerobj = new VueRouter({
        routes:[
            {
                path:"/login",
                component:login
            },
            {
                path:"/resign",
                component:resign
            }
        ]
    })
    let vm = new Vue({
        el: '#app',
        data: {
             msg:'hello vue.js'
        },
        methods: {},
        //引入路由规则
        router:routerobj
    })
</script>
</html>